/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dbhandler;

import evthandler.EventMessage;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Casper, Dennis, Jackie, Jakob
 * @version 1.00
 */
public class Category{

    private int categoryNo;
    private String categoryName;

    /**
     *
     * @param categoryNo The Primary Key
     */
    public Category(int categoryNo) {
        this.categoryNo = categoryNo;
        try {
            ResultSet rs = DbCon.getInstance().executeQuery("SELECT categoryName FROM category WHERE categoryNo=" + categoryNo);
            while (rs.next()) {
                categoryName = rs.getString("categoryName");
            }
        } catch (SQLException ex) {
            new EventMessage("SQL error in Category", "There was an error performing the sql inquery\n").showException(ex);
        }
    }

    /**
     *
     * @return
     */
    public int getCategoryNo() {
        return categoryNo;
    }

    /**
     *
     * @return
     */
    public String getCategoryName() {
        return categoryName;
    }
}
